package com.leetcode.q11;

/**
 * <p> description: desc</p>
 *
 * @author tanzc
 * @date 2022/3/30
 **/
public class MaxArea {
    public int maxArea(int[] height) {
        int i = 0, j = height.length - 1;
        int maxl, maxr, max = 0;
        while (i < j) {
            if (Math.min(height[i], height[j]) * (j - i) > max) {
                max = Math.min(height[i], height[j]) * (j - i);
                maxl = i;
                maxr = j;
            }
            if (height[i] > height[j]) {
                j--;
            } else {
                i++;
            }
        }
        return max;
    }

    public int min(int a, int b) {
        return Math.min(a, b);
    }
}
